<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
 <head> 
  <meta charset="utf-8" /> 
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> 
  <meta name="description" content="" /> 
  <meta name="author" content="" /> 
  <!--<meta http-equiv="refresh" content="60">-->
  <!--[if IE]>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<![endif]--> 
  <title>首页</title> 
  <!-- BOOTSTRAP CORE STYLE  --> 
  <link href="__STATIC__/index/css/bootstrap.css" rel="stylesheet" /> 
  <!-- FONT AWESOME STYLE  --> 
  <link href="__STATIC__/index/css/font-awesome.css" rel="stylesheet" /> 
  <!-- CUSTOM STYLE  --> 
  <link href="__STATIC__/index/css/style.css" rel="stylesheet" />
  <link rel="stylesheet" type="text/css" href="__STATIC__/index/css/normalize.css" />
  <link rel="stylesheet" type="text/css" href="__STATIC__/index/css/default.css">
  <link rel="stylesheet" type="text/css" href="__STATIC__/index/css/common.css">
   <script src="__STATIC__/index/js/Chart.min.js"></script>
   <script src="__STATIC__/index/js/jquery-1.10.2.js"></script> 
   <script src="__STATIC__/index/js/jquery.min.js"></script>
 <style>
	.buy{
		padding:0.4em 0.6em;margin-left:15px;
		float:left;
	}
	.nav-tabs li a{padding:0;font-size: 14px;}
	.tab-content {
		height:270px;
		overflow: auto;
	}
	.table-bordered tbody tr td {
		padding:0 ;
		font-size: 14px;
	}
	.table{margin-bottom:0;}
	.panel-body{
		padding-top:5px;
	}
	.menu-section{
		border-bottom:1px solid #9170E4;
	}
	.footer-section{
		padding:5px 50px;
		border-top: 1px solid #9170E4;
	}
	#open-hao{
		width:20px; 
		height:20px;
		border-radius:5px;
		float:left;
		margin-right:5px;
	}
	#zhang{
		border:none;
		color:#FFF;
		box-shadow: 2px 2px 1px #888888;
		margin-left: 25px;
	}
	#die{
		border:none;
		color:#FFF;
		box-shadow: 2px 2px 1px #888888;
	}

	/*兼容6*/
	@media (max-width:375px){
		#open-hao{
			width:19px; 
			height:19px;
		}
	}

	/*兼容*/
	@media (max-width:360px){
		#open-hao{
			width:18px; 
			height:18px;
			/*margin-right:3px;*/
		}
		#zhang{
			margin-left: 8px;
		}
	}
	
	/*兼容5S*/
	@media (max-width:320px){
		#open-hao{
			width:18px; 
			height:18px;
			margin-right:2px;
		}
		#zhang{
			margin-left: 8px;
		}
	}
    .red{
    	color:red;
    }
	</style>
 </head> 
 <body> 
 
<style>
.navbar-toggle .icon-bar{
	width:15px;
}
#menu-top{
	background: #f7f7f7;
	padding:5px;
	padding-left:10px;
	display: none;
}
#menu-top li{
	margin-bottom:5px;
	
}
#menu-top li a{
	padding:2px 0;
	text-align: left;
}

#game-title{
	font-size: 16px;
}
#login{
	padding:4px 7px;
}
#register{
	margin-left:5px;
	padding:4px 7px;
}
.login-left{
	float:right;
	padding: 3px 10px 0 0;
	height:30px;
}
.money{
	margin-left:4px;
	color:green;
	padding-top:7px;
	word-break:break-all;
	word-wrap:break-word;
	padding-left:0px;
	padding-right:0px;
	font-size:14px;
	margin-left:16%;
	padding-bottom:0;
	height:20px;
}

.yonghu{
	float: left;
	font-size: 18px;
	line-height: 20px;
	color:#777;
	word-break:break-all;
	word-wrap:break-word;
	margin-left:15%;
	padding-top:7px;
	font-size:14px;
}

/*兼容6*/
@media (max-width:375px){
	#game-title{
		font-size: 15px;
	}

	#login{
		padding:2px 5px;
	}
	#register{
		margin-left:3px;
		padding:2px 5px;
	}
	.login-left{
		padding: 5px 10px 0 0;
	}
	.money{
		margin-left:10%;
	}
}

/*兼容5S*/
@media (max-width:320px){
	#game-title{
		font-size: 15px;
	}

	#login{
		padding:2px 5px;
	}
	#register{
		margin-left:3px;
		padding:2px 5px;
	}
	.login-left{
		padding: 5px 8px 0 0;
	}
	.money{
		margin-left:5%;
	}
	.yonghu{
		margin-left:5%;
	}
}
.ball1{
	background-color: #FEFA0A;
}
.ball2{
	background-color: #008DFF;
}
.ball3{
	background-color: #4D4A4D;
}
.ball4{
	background-color: #FE7700;
}
.ball5{
	background-color: #8CFBFD;
}
.ball6{
	background-color: #3E0DED;
}
.ball7{
	background-color: #E2E5E2;
}
.ball8{
	background-color: #FA0700;
}
.ball9{
	background-color: #750002;
}
.ball10{
	background-color: #21CE06;
}
@media (min-width:768px){
	.navbar-toggle{
		display:block;
	}
}
</style>
<div class="navbar navbar-inverse set-radius-zero" style="min-height:35px;height:37px;">
	<div class="container" style="height:35px;">
		<div class="navbar-header"  style="height:35px;">
			<a class="navbar-brand" style="padding:0" href="{:url('index/index/index')}">
				<!--<img src="__STATIC__/index/logo.jpg" style="width:30px;height:30px;position:absolute;margin:0px 0px;top:3px;left:4px;" />-->
			</a>
			<span id="game-title" style="float: left;margin-left:5px;margin-top:5px;font-size: 13px;">幸运理财&nbsp;<a href="{:url('index/index/index')}" style="font-size: 13px;margin-right10px;">首页</a>&nbsp;
		    </span>			
			<span style="color: red;font-size: 13px;line-height: 32px;">
				{if condition="session('uid') eq null"}	
					<span><a href="{:url('index/login/index')}" class="btn btn-info" id="login" >登录</a></span>
					<span><a href="{:url('index/register/index')}" class="btn btn-info" id="register" >注册</a></span>
				{else/}
				       <span style="color:#404d5b;line-height: 40px;"> 用户名 : {:session('username')}</span>&nbsp;
				       <span style="color:#404d5b;line-height: 40px;" id="moneys"> 积分 : {$money['money']}</span>
             	{/if}
			    <span id="uid" style="display: none">{:session('uid')}</span>
            	</span>           
		</div>

		<!-- <div class="right-div">
			<a href="#" class="btn btn-danger pull-right">LOG ME OUT</a>
		</div> -->
	</div>
</div>
<!-- LOGO HEADER END-->


 <script>

var width = $(window).width();

//var ipone5 = 320;
//var ipone6 = 375;
//var ipone6P = 414;
//if(width<=ipone6 && width>ipone5){
	//$(".money").css({marginLeft:'15%'});
//}
//if(width<=ipone6P && width>ipone6){
	//$(".money").css({marginLeft:'20%'});
//}


$('.navbar-toggle').click(function(){
	if($('#menu-top').css('display')=='none'){
		$('#menu-top').show();
	}else{
		$('#menu-top').hide();
	}
	
});

 </script>
 
  <div class="content-wrapper" style="margin-top:0;padding:0;min-height: 500px;"> 
   <div class="container"> 
<!-- 开盘区 -->
  <table class="table table-striped table-bordered table-hover dataTable no-footer"  aria-describedby="dataTables-example_info"  style="padding:3px 0;"> 
           <tbody>
            <tr class="gradeC odd"> 
	             <td class="sorting_1" width="25%" style="text-align:center; vertical-align:middle;height:31px;font-size:10px;">
	             	{empty name="new"}	
					{else /}	
					{$new.qishu}期
				    {/empty}
	             </td> 
	             <td class="sorting_2" style="vertical-align:middle;" >
	             	&nbsp;
	             	<div class="ball1" style="width: 20px;float:left;margin-left:5px; ">
                	 	<span style="height:20px; line-height:20px; display:block; color:#FFF; text-align:center;"></span>
					</div>

					<div class="ball2" style="width: 20px;float:left;margin-left:5px; ">
                	 	<span style="height:20px; line-height:20px; display:block; color:#FFF; text-align:center;"></span>
					</div>
					<div class="ball3" style="width: 20px;float:left;margin-left:5px; ">
                	 	<span style="height:20px; line-height:20px; display:block; color:#FFF; text-align:center;"></span>
					</div>
					<div class="ball4" style="width: 20px;float:left;margin-left:5px; ">
                	 	<span style="height:20px; line-height:20px; display:block; color:#FFF; text-align:center;"></span>
					</div>
					<div class="ball5" style="width: 20px;float:left;margin-left:5px; ">
                	 	<span style="height:20px; line-height:20px; display:block; color:#FFF; text-align:center;"></span>
					</div>
					<div class="ball6" style="width: 20px;float:left;margin-left:5px; "> 
                	 	<span style="height:20px; line-height:20px; display:block; color:#FFF; text-align:center;"></span>
					</div>
					<div class="ball7" style="width: 20px;float:left;margin-left:5px; ">
                	 	<span style="height:20px; line-height:20px; display:block; color:#FFF; text-align:center;"></span>
					</div>
					<div class="ball8" style="width: 20px;float:left;margin-left:5px; ">
                	 	<span style="height:20px; line-height:20px; display:block; color:#FFF; text-align:center;"></span>
					</div>
					<div class="ball9" style="width: 20px;float:left;margin-left:5px; ">
                	 	<span style="height:20px; line-height:20px; display:block; color:#FFF; text-align:center;"></span>
					</div>
					<div class="ball10" style="width: 20px;float:left;margin-left:5px; ">
                	 	<span style="height:20px; line-height:20px; display:block; color:#FFF; text-align:center;"></span>
					</div>
					<!-- 
	             	 {foreach name='new2' item='v'}
                     <div id="open-hao" class="ball{$v}">
                    	 <span style="height:20px; line-height:20px; display:block; color:#FFF; text-align:center;">{$v}</span>
							</div>
                    
                    {/foreach} -->

										
	             </td> 
            </tr>
    	<tr>
     <td  style="text-align:center;height:30px;line-height:30px;font-size:10px;" class="sorting_3"><span id="nexts">{$next_qishu}</span>期</td>
	     <td style="  vertical-align:middle;" id="jishi">
			封盘 <span style="border:1px solid #b18b8b;padding:0 4px;" class="fengpan"><span id="fp_m">00分</span><span id="fp_s">00秒</span></span>  
			开奖 <span style="border:1px solid #b18b8b;padding:0 4px;" class="kaijiang"><span id="kj_m">00分</span><span id="kj_s">00秒</span></span> 
	     </td>				
	   <!--  <td  style="text-align:center;height:30px;line-height:30px;" class="sorting_3"><span id="nexts">{$next_qishu}</span>期</td>
	     <td style="  vertical-align:middle;" id="jishi">
			封盘 <span style="border:1px solid #b18b8b;padding:0 4px;" class="fengpan"><span id="fp_m">00分</span><span id="fp_s">00秒</span></span>  
			开奖 <span style="border:1px solid #b18b8b;padding:0 4px;" class="kaijiang"><span id="kj_m">00分</span><span id="kj_s">00秒</span></span> 
	     </td>		 -->
	  </tr>
			
			
			   
           </tbody> 
          </table>

<!-- 开盘区 -->

    <div class="row"> 
     <div class="col-md-12" style="padding:0;"> 
      <!-- Advanced Tables -->
        
      <!--End Advanced Tables --> 
     </div>
    <div class="col-md-6 col-sm-6" style="padding:0;margin-bottom: 53px;">
        <div class="panel panel-default">
            <div class="panel-body">
                <ul class="nav nav-tabs">
                    <li class="active" style="width:33.3%;text-align: center;"><a href="#home" data-toggle="tab" id="homeUrl">开奖结果</a>
                    </li>
                   <!--  <li style="width: 33.3%;text-align: center;"><a href="#orderBy" data-toggle="tab">龙虎榜</a>
                    </li> -->
                    <li class="" style="width: 33.3%;text-align: center;"><a href="#profile" data-toggle="tab" id="canvasImg">位置走势图</a>
                    </li>
                </ul>

                <div class="tab-content">
                    <div class="tab-pane fade active in" id="home">
                        <!--    Context Classes  -->
				        <div class="panel panel-default">
				                <div class="table-responsive">
				                    <table class="table table-bordered" style="text-align:center;position:relative;z-index: 99">
				                        <tbody>
				                        {volist name="data" id="vo"}	
				                        {empty name="$vo.ball1"}
				                        {else/}
				                        <tr class="success">
				                                <td style="width:33%;">{$vo.qishu}</td>
				                                <td style="width:33%;">
				                                	{switch $vo.ball1}
													{case 1}<div style="width:18px; height:18px; background-color:#FEFA0A; border-radius:5px;margin:0 auto;">{/case}
													{case 2}<div style="width:18px; height:18px; background-color:#008DFF; border-radius:5px;margin:0 auto;">{/case}
												    {case 3}<div style="width:18px; height:18px; background-color:#4D4A4D; border-radius:5px;margin:0 auto;">{/case}
												    {case 4}<div style="width:18px; height:18px; background-color:#FE7700; border-radius:5px;margin:0 auto;">{/case}
												    {case 5}<div style="width:18px; height:18px; background-color:#8CFBFD; border-radius:5px;margin:0 auto;">{/case}
												    {case 6}<div style="width:18px; height:18px; background-color:#3E0DED; border-radius:5px;margin:0 auto;">{/case}
												    {case 7}<div style="width:18px; height:18px; background-color:#E2E5E2; border-radius:5px;margin:0 auto;">{/case}
												    {case 8}<div style="width:18px; height:18px; background-color:#FA0700; border-radius:5px;margin:0 auto;">{/case}
												    {case 9}<div style="width:18px; height:18px; background-color:#750002; border-radius:5px;margin:0 auto;">{/case}
													{default/}<div style="width:18px; height:18px; background-color:#21CE06; border-radius:5px;margin:0 auto;">
													{/switch}
				    					             <span style="height:18px; line-height:18px; display:block; color:#FFF; text-align:center">{$vo.ball1}</span>
								                    </div> 
							                    </td>
				                                <td style="width:33%;">
				                                	{switch $vo.status}
				                                	{case 0}<span style="color:#13c813;">{/case}
				                                	{case 1}<span style="color:#f42a25;">{/case}
				                                	{/switch}
				                                	{$vo.page}</span></td>

				                        </tr>
				                        {/empty}
				                        {/volist}  
                                     </tbody>
				                    </table>
				                </div>
				        </div>   
				                <div style="width: 100%;height: 200px;margin-top: -860px;"></div>
				                <div style="width: 100%;height:400px;position: relative;z-index: 98;top:320px;"></div>
				        <!--  end  Context Classes  -->
                    </div>
                    <div class="tab-pane fade" id="orderBy">
                        <!--    Context Classes  -->
				        <div class="panel panel-default">
				                <div class="table-responsive">
				                    <table class="table table-bordered" style="text-align:center;word-break:break-all;word-wrap:break-word;">
				                    	<tr>
				                    		<td width="33.3%">排名</td>
				                    		<td width="33.3%">用户</td>
				                    		<td width="33.3%">收益</td>
				                    	</tr>
				                        <tbody>
				                        	{volist name="win" id="vo"}
				                            <tr class="">
				                                <td>{$key+1}</td>
				                                <td><?php 
				                                	echo  substr_replace($vo['username'],'****',1,-1); 
				                                	?><!-- {$vo.username} --></td>   	    
				                                <td>{$vo.winmoneys}</td>
				                            </tr>
				                        	{/volist}				                       
				                         </tbody>
				                    </table>
				                </div>
				        </div>
				        <!--  end  Context Classes  -->
                    </div>
                    <div class="tab-pane fade active in" id="profile" style="overflow-x:scroll;">
                        <canvas id="myChart" height="250" width="500" style="position: fixed;z-index: 97;"></canvas>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div> 
   </div> 
  </div> 
  <!-- CONTENT-WRAPPER SECTION END--> 
  <section class="footer-section" style="position:fixed;bottom:0;width:100%;padding-bottom: 40px;padding-top: 40px;z-index: 100;"> 
     {if condition="$notice.0.show eq 0"}	
     {else /}
      	<div  style="width:100%;margin: auto;margin-top: -30px;margin-left: -30px; margin-bottom: -10px;">
	  	<marquee onmouseover=this.stop() onmouseout=this.start() scroollAmount=3  ><span style="color:red;font-size: 13px;">{$notice.0.content}</span></marquee>
	    </div>
     {/if}
	<div style="margin: auto;width: 120%;">
    	<input class="form-control" type="number"  name="money" style="width:135px;float:left;font-size:12px;margin-left: -40px;" placeholder="赔率：1:{$set}" id="money" step="0.01">
    	<button href="#" class="btn btn-danger buy"  value="1" data-type="1" id="zhang" style="background-color: red">买涨</button>
    	<button href="#" class="btn btn-success buy"  value="0" data-type="2" id="die" style="background-color: green;left:15px;">买跌</button>
        {if condition="session('uid') eq null"}	
		{else /}
	    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse" style="margin:2px 10px 0 0;height:30px;padding:0px 8px;float: left;margin-left:10px;">
		<span class="icon-bar" style="background-color: white;"></span>
		<span class="icon-bar" style="background-color: white;"></span>
		<span class="icon-bar" style="background-color: white;"></span>
		</button>
		{/if}
	
	</div>

<script>
	$('.navbar-toggle').click(function(){
	if($('#menu-top').css('display')=='none'){
		$('#menu-top').show();
	}else{
		$('#menu-top').hide();
	}
	
});
</script>

  </section> 
      	<ul id="menu-top" class="nav navbar-nav navbar-right"  style=" z-index:100;width:80px; left:0;background:#F7F7F7;display: none;float: left;position: fixed;bottom:0;font-size: 13px;margin-bottom: 72px;border:1px solid #E3E3E5;margin-left: 235px;">
								<li><a href="{:url('index/index/index')}">首页</a></li>
								<li><a href="{:url('index/order/index')}">投资记录</a></li>
								<li><a href="javasrript:void(0)">今日收益<br/>
								 {empty name="today"}
								（0.00）	
								 {else /}	
								（{$today}）
								 {/empty}
							    </a></li>
								{if condition="$money.vip gt 1"}
								 <li><a href="{:url('index/returns/index')}">退水结果</a></li>
			           			{else/}
			           			{/if}		
								<li><a href="{:url('index/index/rule')}">投资规则</a></li>
								<li><a href="{:url('index/login/loginout')}">退出登录</a></li>
		</ul>
  <!-- FOOTER SECTION END--> 
  <!-- JAVASCRIPT FILES PLACED AT THE BOTTOM TO REDUCE THE LOADING TIME  --> 
  <!-- CORE JQUERY  --> 
  <script src="__STATIC__/index/js/jquery-1.10.2.js"></script> 
  <!-- BOOTSTRAP SCRIPTS  --> 
  <script src="__STATIC__/index/js/bootstrap.js"></script> 
  <script src="__STATIC__/index/layer.js"></script>
  <div style="display:none" id="conFirm">
  	<form id="orderForm">
  		<input type="hidden" name="nper" value="678022">
  		<input type='hidden' value='' name='buy_type'>
  		<input type='hidden' value='' name='buy_money'>
  		<div style="paddin-left:0;">积分：<span id="confirmMoney"></span></div>
  		<div style="paddin-left:0;">方式：<span id="confirmType"></span></div>
  	</form>
  </div>
<!--   <audio autoplay="">
		<source id="tts_source_id" src="http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&spd=9&text=开奖了;" type="audio/mpeg">
		<embed id="tts_embed_id" height="0" width="0" src="">
   </audio> -->
 </body>
</html>
<script>
/*	   var nexts = $("#nexts").text();
	   $.ajax({
			url:"{:url('index/index/datas')}",
			qishu:nexts,
			success:function(data) {
				if(data == 200){
					location.href="{:url('index/login/index')}";
				}
		    },
	});*/
/*setInterval(function () {
   $.ajax({
			url:"{:url('index/index/datas')}",
			success:function  (data) {
				alert(data);
				if(data == 200){
					console.log(data);
				}else{
					console.log(data);
				}
		    },
	});
},2000);*/



$("#zhang").click(function(){
	var uid = $("#uid").text();
	var nexts = $("#nexts").text();
	var money = $("#money").val();
	var updown = $("#zhang").val();
	if(uid == ""){
		 alert('你还没进行登录');
		 location.href="{:url('index/login/index')}";
	}else{
	var reg= /^(-?\d+)(\.\d{1,2})?$/
	if(money < 1){
		alert("单笔最低投资金额1元");
		return false;
	};
	if(parseFloat(money)>50000){
		alert("单笔最高投资金额50000元");
		return false;
	};
	if(!reg.test(money)){
       alert("积分不能超过两位小数");
       return false;
	};
	/*location.href = "result.php?id="+$this.value+"&g_date="+texts;*/
	window.location.href="{:url('index/index/successs')}?qishu="+nexts+"&money="+money+"&updown="+updown+"&uid="+uid;//解析成功
	}
	/*$.post('{:url('index/orders/index')}',{qishu:nexts,money:money,updown:updown},function(data) {  
	          if(data== 200){
		        location.href="{:url('index/index/successs')}";
		      }else if(data == 101){
		      	alert("账户余额不足");
		      }else if(data == 102){
		      	alert("下注失败");
		      }else{
		      	alert("请求失败");
		    }            
      }); */
});
$("#die").click(function(){
	var uid = $("#uid").text();
	var nexts = $("#nexts").text();
	var money = $("#money").val();
	var updown = $("#die").val();
	if(uid == ""){
		 alert('你还没进行登录');
		 location.href="{:url('index/login/index')}";
	}else{
	if( money < 1){
		alert("单笔最低投资金额1积分");
		return false;
	};
	if(parseFloat(money)>50000){
		alert("单笔最高投资金额50000积分");
		return false;
	};
	var reg= /^(-?\d+)(\.\d{1,2})?$/
	if(!reg.test(money)){
       alert("积分不能超过两位小数");
       return false;
	};
	window.location.href="{:url('index/index/successs')}?qishu="+nexts+"&money="+money+"&updown="+updown;//解析成功
	}
/*	$.post('{:url('index/orders/index')}',{qishu:nexts,money:money,updown:updown},function(data) {
	          if(data== 200){
		      	location.href="{:url('index/index/successs')}";
		      }else if(data == 101){
		      	alert("账户余额不足");
		      }else if(data == 102){
		      	alert("下注失败");
		      }else{
		      	alert("请求失败");
		    }                   
      }); */
});

var time = "{$newtime}";
var NowTime = new Date();
var test = NowTime.getTime();
test = Math.floor(test/1000);
var cha = time-test;
//封盘倒计时
function GetRTime(){
	var NowTime = new Date();
	var fp_time = "{$feng_time}";
	//console.log(fp_time);
	
    var EndTime= new Date(fp_time);
    	//alert(EndTime);
    var t =EndTime.getTime() - (NowTime.getTime()+cha*1000);	
    /*var t =EndTime.getTime() - (NowTime.getTime()+cha*1000);
	*/
	//console.log(EndTime.getTime() NowTime.getTime());
    var m=0;
    var s=0;
	var h=0;
    if(t>=0){
     
	  h=Math.floor(t/1000/3600);
      m=Math.floor(t/1000/60%60);
      s=Math.floor(t/1000%60);
    }
	if(h<=0 && m<=3){
		document.getElementById("fp_m").innerHTML = m + "分"
		document.getElementById("fp_s").innerHTML = s + "秒";
		if(m==0 && s<=30 && h==0){
			$(".fengpan").addClass('red');
		}
		if(m==0 && s==0 && h==0){
			clearInterval(window.fengpan);
			var url = "http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&text=" + encodeURI('封盘了');
        　　var n = new Audio(url);
       　　 n.src = url; 
            n.play();
			$('#zhang').css({'background-color':'#ccc'});
			$('#die').css({'background-color':'#ccc'});
			$('#zhang').attr('disabled','disabled');
			$('#die').attr('disabled','disabled');
		}
	}else{
		$(".fengpan").html('尚未开启');
		
	}
    
}
/*document.write(GetRTime);*/
var fengpan = setInterval(GetRTime,0);

//开奖倒计时
function GetRTime1(){

	var fp_time = "{$kaij_time}";
	//var EndTime= new Date('2017-05-23 21:02:00');
    var EndTime= new Date(fp_time);

    var NowTime = new Date();
    var t = EndTime.getTime() - NowTime.getTime();

    var m=0;
    var s=0;
	var h=0;
    if(t>=0){
	  h=Math.floor(t/1000/3600);
      m=Math.floor(t/1000/60%60);
      s=Math.floor(t/1000%60);
    }
   
	if(h<=0 && m<=5){
		document.getElementById("kj_m").innerHTML = m + "分";
		document.getElementById("kj_s").innerHTML = s + "秒";
		if(m==0 && s==0 && h==0){

			clearInterval(window.kaijiang);
			clearInterval(window.fengpan);
			$('#zhang').css({'background-color':'#ccc'});
			$('#die').css({'background-color':'#ccc'});
			$('#zhang').attr('disabled','disabled');
			$('#die').attr('disabled','disabled');
/*			$.post('{:url('index/index/datas')}',function(data) {
			if(data == 200){
				console.log(data);
			}else{
				console.log(data);
			} 
            });*/
            var nexts = $("#nexts").text();
            var qishu = {$new.qishu};
            $.ajax({
             type: "post",
             url: "{:url('index/index/data')}",
             data: {qishu:qishu,nexts:nexts},
             dataType: "json",
             success: function(data){
             			
             			$(".ball1 span").html(data.qishu.ball1);
             			$(".ball2 span").html(data.qishu.ball2);
             			$(".ball3 span").html(data.qishu.ball3);
             			$(".ball4 span").html(data.qishu.ball4);
             			$(".ball5 span").html(data.qishu.ball5);
             			$(".ball6 span").html(data.qishu.ball6);
             			$(".ball7 span").html(data.qishu.ball7);
             			$(".ball8 span").html(data.qishu.ball8);
             			$(".ball9 span").html(data.qishu.ball9);
             			$(".ball10 span").html(data.qishu.ball10);
             			// if(data.nexts.open == 1){
             			// 	alert("开奖了");
             			// 	location.href="{:url('index/index/index')}";
             			// }
             			// console.log(data);
                        // location.href="{:url('index/index/index')}";
                      }
         	});

            // $.post('{:url('index/index/data')}',{qishu:nexts},function(data){
            // });

             // alert("开奖了");
             // location.href="{:url('index/index/index')}";

	     /*   alert("开奖了"); */
	    /*    clearInterval(window.kaijiang);
			clearInterval(window.fengpan);*/
           /* location.href="{:url('index/index/index')}";*/
	/*	     var url = "http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&spd=9&text=开奖了";
        　　 var n = new Audio(url);
       　　  n.src = url; 
             n.play();
	        setInterval(function () {  
	        }, 2000); */
		}
	}else{
		$(".kaijiang").html('尚未开启');	
	}  
}
var kaijiang = setInterval(GetRTime1,0);


//开码兼容
var ma_div = $('.sorting_2').width();
if(ma_div<=204){
	$('.sorting_2').children('div').css({width:"14px",height:"14px",fontSize:'12px',lineHeight:'14px'});
	$('.sorting_2').children('div').children('span').css({lineHeight:'14px',width:'14px'});
	
}
if(ma_div<=245){
	$('.sorting_2').children('div').css({width:"17px",height:"17px",fontSize:'13px',lineHeight:'17px'});
	$('.sorting_2').children('div').children('span').css({lineHeight:'17px',width:'17px'});
	
}

var jishi =  $('#jishi').width();
if(jishi<=231){
	$('#jishi').css({fontSize:"14px"});
}

var sorting_1 = $('.sorting_1').width();
if(sorting_1<=68){
	$('.sorting_1').css({fontSize:"14px"});
	$('.sorting_3').css({fontSize:"14px"});
	
	
}


//数据显示
var tab_content  = $('.tab-content').width();
var ipone6 = 343;
var ipone6P = 382;
var ipone5= 288;

if(tab_content<=ipone5){
	$('.tab-content').height('360px');
	$('#die').css({marginLeft:'20px'});
	$('.buy').css({padding:'0.3em 0.5em'});
}
if(tab_content<=ipone6 && tab_content>ipone5 ){
	$('.tab-content').height('460px');
}
if(tab_content<=ipone6P && tab_content>ipone6 ){
	$('.tab-content').height('528px');
}

 $(function(){
	//两秒刷新一次开奖
	  setInterval(function () { 
		$("#dataTables-example").load(location.href+" #dataTables-example"); 
	  }, 2000);
  })

$.get("{:url('index/index/index2')}",function(msg){
   var ctx = document.getElementById('myChart').getContext('2d');
   var chart = new Chart(ctx, {
    // 要创建的图表类型
    type: 'line',

    // 数据集
    data: {
        labels: [msg[0]['qishu']+'期', msg[1]['qishu']+'期', msg[2]['qishu']+'期', msg[3]['qishu']+'期',msg[4]['qishu']+'期', msg[5]['qishu']+'期', msg[6]['qishu']+'期',msg[7]['qishu']+'期',msg[8]['qishu']+'期',msg[9]['qishu']+'期'],
        datasets: [{
            label: "位置走势图",
            backgroundColor: 'rgba(151, 187, 205,0.3)',
            borderColor: 'rgb(151, 187, 205)',
            data: [msg[0]['ball1'], msg[1]['ball1'], msg[2]['ball1'], msg[3]['ball1'], msg[4]['ball1'], msg[5]['ball1'], msg[6]['ball1'], msg[7]['ball1'], msg[8]['ball1'], msg[9]['ball1']],
        }]
    },
    // 配置项
    options: {}
    });
});
</script>